package YuanFuDao;

import java.util.TreeMap;

/**
 *
 */
public class Main3 {
    public static void main(String[] args) {
        int[][] time =  {{1,4},{1,3},{2,3},{3,4}};
        int res = help(time);
        System.out.println(res);
    }

    public static int help(int[][] time){
        TreeMap<Integer,Integer> map = new TreeMap<>();
        int n = time.length;
        for (int i = 0; i < n; i++) {
            map.put(time[i][0],map.getOrDefault(time[i][0],0)+1);
            map.put(time[i][1],map.getOrDefault(time[i][1],0)-1);
        }
        int active = 0,res = 0;
        for(int d : map.values()){
            active += d;
            if(active > res) res = active;
        }
        return res;
    }

}
